<?php 
echo $this->element('reportcss'); 
$file_name = "入驻企业融资情况统计表";
if(empty($report)){?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2><?php echo $file_name;?></h2>
	</div>
    <?php
    	$url_explode=explode("group=", $_SERVER["QUERY_STRING"]);
    	echo '<div class="right back_btn">';
		echo $html->link("导出报表","/reports/finacreport/1?group=".$url_explode[1]);
		echo '</div>';
	?> 
	<?php echo $this->element('reportgroup'); ?>	
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
        <div class="items_list">
<?php }?>
			<?php 
        		if(!empty($report)){
        			echo "<div align='center'><h3>$file_name</h3></div>";
        		}
        	?>
        	<table border='1'>
            	<tr>
            		<th>序号</th>
                    <th>单位名称</th>
                    <th>模块</th>
		 			<th>人才姓名</th>
		 			<th>国籍</th>
		 			<th>学历学位</th>
		 			<th>注册时间</th>
		 			<th>注册资金(万元)</th>
		 			<th>融资金额(万元)</th>
		 			<th>融资金额占股(%)</th>
		 			<th>融资时间</th>
		 			<th>融资渠道</th>
		 			<th>融资来源</th>
                </tr>
		 		<?php 
		 			$i = 1;
		 			foreach($companys as $company)
		 			{
		 				$j = 0;
		 				$cname = $company["SearchCompany"]["company_name"];//单位名称
		 				$contact = $company["SearchCompany"]["contact"];//人才姓名
		 				$groupname = $grouplist[$company["SearchCompany"]["groupid"]];
		 				$nation = $company["SearchCompany"]["nation"];//国籍
		 				$education = "";
		 				$edu = $company["SearchCompany"]["education"];
		 				if(!empty($edu))
		 					$education = $education_array[$edu];//学历学位
		 				$reg_time = date("Y-m-d",strtotime($company["SearchCompany"]["reg_time"]));//注册时间
		 				$cap_type = $company["SearchCompany"]["cap_type"];
		 				$capital = $company["SearchCompany"]["capital"];
		 				if($cap_type == 1)
		 					$capital .= "(美元)";
		 				
		 				$finacs = $company["CompFinanc"];
		 				$finacs_num = count($finacs);
		 				
		 				if($finacs_num != 0)
		 				{	
			 				foreach($finacs as $finac)
			 				{
			 					$money = $finac["money"];//融资金额
			 					$percent = $finac["percent"];//融资金额占股
			 					$fin_time = date("Y-m-d",strtotime($finac["fin_time"]));//融资时间
			 					$fin_channels = $finac["fin_channels"];//融资渠道
			 					$type_id = $finac["type_id"];
			 					$type_value = classregistry::init('Codevalue')->read('value',$type_id);
			 					
			 					echo "<tr>";
			 					if($j == 0)
			 					{
					 				echo "<td align='center' rowspan='".$finacs_num."'>".$str->formatCell($i)."</td>";
					 				echo "<td align='center' rowspan='".$finacs_num."'>".$str->formatCell($cname)."</td>";
					 				echo "<td align='center' rowspan='".$finacs_num."'>".$str->formatCell($groupname)."</td>";
					 				echo "<td align='center' rowspan='".$finacs_num."'>".$str->formatCell($contact)."</td>";
					 				echo "<td align='center' rowspan='".$finacs_num."'>".$str->formatCell($nation)."</td>";
					 				echo "<td align='center' rowspan='".$finacs_num."'>".$str->formatCell($education)."</td>";
					 				echo "<td align='center' rowspan='".$finacs_num."'>".$str->formatCell($reg_time)."</td>";
					 				echo "<td align='center' rowspan='".$finacs_num."'>".$str->formatCell($capital)."</td>";
			 					}
			 					
			 					echo "<td align='center' >".$str->formatCell($money)."</td>";
			 					echo "<td align='center' >".$str->formatquantity($percent)."</td>";
			 					echo "<td align='center' >".$str->formatCell($fin_time)."</td>";
			 					echo "<td align='center' >".$str->formatCell($fin_channels)."</td>";
								echo "<td align='center' >".$str->formatCell($type_value["Codevalue"]["value"])."</td>";
			 					$j++;
			 					echo "</tr>";
			 				}
			 				$i++;
		 				 }	
		 			}
		 		?>
            </table>
<?php if(empty($report)){ ?>
		</div>
    </div>
</div>
<?php }?>